import requests
import pytest
import uuid
class Testloginz():
    @pytest.fixture(scope="function", autouse=True)
    def setup_teardown(self):
        res= requests.post(url="http://60.205.190.66:8899/adminapi/login",json={"account":"admin","pwd":"123456","imgcode":"2"})
        self.token='Bearer'+ res.json()['data']['token']
        assert res.status_code==200
        assert res.json()['msg'] =='ok'
        yield
        print('登录成功')
        print('退出登录')

    def testfz(self):
        self.uuid = str(uuid.uuid4()).split('-')[0]
        res=requests.post(url='http://60.205.190.66:8899/adminapi/user/user_group/save.html',headers={"Content-Type":"application/json;charset=UTF-8","Authori-zation":self.token}
                      ,json = {"group_name":"分组" + self.uuid})
        assert res.status_code==200
        assert  res.json()['msg']=="提交成功！"
if __name__ == '__main__':
    pytest.main()